/***************************************************************************
 创建者：华磊
 开始时间：               : 2020.1１.09
 copyright            : (C) 深圳市华友高科有限公司
 修改说明：（每次有修改就添加一条，带有 修改人，修改时间，修改描述）

 ***************************************************************************
 *   顶部视窗对话框
*                                                                         *
 ***************************************************************************/
#include "currentcoordinate.h"
#include "ui_currentcoordinate.h"
#include "topview.h"
#include <QDebug>

CurrentCoordinate::CurrentCoordinate(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::CurrentCoordinate)
{
    ui->setupUi(this);
    setAttribute(Qt::WA_QuitOnClose, false);
//    initCoordinateSize(100,100);
//    isEnableSet=false;
    for(int i=0;i<100;i++)
    {
          ui->combobox_user->addItem(QString::number(i));
          ui->combobox_tool->addItem(QString::number(i));
    }
}

CurrentCoordinate::~CurrentCoordinate()
{
    delete ui;
}

void CurrentCoordinate::initCoordinateSize(int tool, int user)
{
//    isEnableSet=false;
    if(tool>0)
    {
        ui->combobox_tool->clear();
        for(int i = 0;i<tool;i++)
        {
            ui->combobox_tool->addItem(QString::number(i));
        }
    }
//    ui->combobox_tool->setCurrentIndex(toolIndex);

    if(user>0)
    {
        ui->combobox_user->clear();
        for(int i = 0;i<user;i++)
        {
            ui->combobox_user->addItem(QString::number(i));
        }
    }
//    ui->combobox_user->setCurrentIndex(userIndex);
//    isEnableSet=true;
}

void CurrentCoordinate::updateCoordinateData()
{
    //用户 工具
    ui->combobox_user->setCurrentIndex(topView->currentUserCoordinate);
    ui->combobox_tool->setCurrentIndex(topView->currentToolCoordinate);
    //法兰 外部
}

void CurrentCoordinate::changeLanguage()
{
    ui->retranslateUi(this);
}

void CurrentCoordinate::on_radioButton_clicked()
{
    emit ipoModeFanuc();
    //topView->updateCurrentCoordinateView();
}

void CurrentCoordinate::on_radioButton_2_clicked()
{
    emit ipoModeExtra();
    //topView->updateCurrentCoordinateView();
}

void CurrentCoordinate::on_combobox_user_currentIndexChanged(int index)
{
    if(index>=0 )
    {
        emit changeCurrentUserCoordinate(index);
    }

}



void CurrentCoordinate::on_combobox_tool_currentIndexChanged(int index)
{
    if(index>=0 )
    {
        emit changeCurrentToolCoordinate(index);
    }
}
